﻿@{
    ViewBag.Title = "单据分组";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <div class="layui-form-item" style="margin: 10px 0 0;">
                <label class="layui-form-label" style="width: auto; padding-right: 5px;">名称筛选：</label>
                <div class="layui-input-inline">
                    <input type="text" name="keyWord" class="layui-input" value="@ViewBag.Keyword">
                </div>
                <button type="button" class="layui-btn searchButton">搜索</button><a class="layui-btn" href="javascript:ShowPage('/Admin/FormGroup/Create','添加单据分组')">添加单据分组</a>
            </div>
        </form>

        <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:200}" id="resultList" lay-filter="resultList">
            <thead>
                <tr>
                    <th lay-data="{field:'ID', width:80}">ID</th>
                    <th lay-data="{field:'Name'}">名称</th>
                    <th lay-data="{field:'ParentFormGroupID', width:80}">上级ID</th>
                    <th lay-data="{field:'Sort', width:60}">排序</th>
                    <th lay-data="{fixed:'right', width:120, align:'center', toolbar: '#barDemo'}">操作</th>
                </tr>
            </thead>
        </table>


        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Admin/FormGroup/Edit?id={{d.ID}}','修改单据分组')" >修改</a>
            <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:DeleteItemt('{{d.ID}}')">删除</a>
        </script>

    </div>
</div>
<script type="text/javascript">
    function DeleteItemt(id) {
        layer.confirm('您正在进行删除单据分组操作', {
            btn: ['是的,我要删除单页分组', '不小心点错了'] //按钮
        }, function () {
            var url = "/Admin/FormGroup/Delete?id=" + id;
            $.getJSON(url, function (data) {
                layer.closeAll();
                layer.msg(data.Msg);
                if (data.State === 200) {
                    $(".layui-laypage-btn")[0].click();
                }                
            });
        }, function () {

        });
    }
    

</script>


